<template>
  <div class="tabbarcon" v-if="tabbarlist.length > 0">
    <div :class="['item',index==item.id?'active':'']" v-for="item in tabbarlist" :key="item.id" @click="handleRouter(item.id)">
      <i :class="['iconfont', item.icon]"></i>
      <span>{{ item.title }}</span>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    tabbarlist: {
      type: Array,
      default: [],
    },
      index: {
      type: Number,
      default: 0,
    },
  },
  methods:{
      handleRouter(id){
         this.$emit("changeTabbar",id) 
      }
  }
};
</script>

<style lang="less" scoped>
div.tabbarcon {
  height: 0.5rem;
  width: 100vw;
  display: flex;
  justify-content: space-around;
  align-items: center;
  div.item {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #333;
    i {
        font-size: 0.24rem;
    }

    span {
        font-size: 0.12rem; 
    }
  }
}

.active{
    color: #2980b9 !important;
}
</style>